import 'package:flutter/cupertino.dart';
import 'package:get/get.dart';

import 'state.dart';

class HomeLogic extends GetxController {
  final HomeState state = HomeState();

  late final PageController pageController;

  handleBottomBarPageChanged(int index){
    pageController.animateToPage(index,
        duration: const Duration(milliseconds: 200), curve: Curves.ease);
    print('Bottom 页面到 ${index}');
  }

  // tab栏页码切换
  void handleTabPageChanged(int page) {
    state.pageIndex = page;
    print('Tab 页面到 ${state.pageIndex}');
  }

  @override
  void onInit() {
    pageController = PageController(initialPage: state.pageIndex);
  }
}
